package com.enn.demo.application.assembler;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.enn.demo.client.common.PageUtil;
import com.enn.demo.core.domain.util.Page;

/**
 * Assembler class for the page.
 *
 * @author haoxin
 * @date 2021-04-04
 **/
public class PageAssembler {
    public static PageUtil toPage(IPage iPage) {
        PageUtil page = new PageUtil(iPage.getRecords(), iPage.getTotal(), iPage.getSize(), iPage.getCurrent());
        return page;
    }

    public static Page toPage(PageUtil iPage) {
        Page page = new Page(iPage.getList(), iPage.getTotalCount(), iPage.getPageSize(), iPage.getCurrPage());
        return page;
    }
}
